<?php

require_once 'common/conn.php';

function updateShare($share) {
    if (is_array($share)) {
        if (isset($share['usercode'])) {
            // 1=文字  2=声音文件
            if (isset($share['type']) && $share['type'] == 1) {
                $sql = "INSERT INTO t_share_record(usercode,type,message,createTime) VALUES('" . $share['usercode'] . "'," . $share['type'] . ",'" . $share['message'] . "',now())";
            } else if (isset($share['type']) && $share['type'] == 2) {
                $sql = "INSERT INTO t_share_record(usercode,type,url,createTime) VALUES('" . $share['usercode'] . "'," . $share['type'] . ",'" . $share['url'] . "',now())";
            }
            if (isset($sql)) {
                $db = new DBC();
                if ($db->execute($sql)) {
                    return true;
                }
            }
        }
    }
    return false;
}

?>
